const { exec } = require('../db/mysql')

/**
 * 登录
 * @param {string} username
 * @param {string} password
 */
const login = (username, password) => {
  const sql = `SELECT * FROM users WHERE username='${username}' AND password='${password}'`
  return exec(sql).then(rows => {
    return rows[0] || {}
  })
}

module.exports = {
  login
}
